package bma.common.langutil.core;

/**
 * 
 * @author guanzhong
 * @since 1.0 (imported from BMA.ESP Project)
 * 
 */
public abstract class SearchForm {

	protected int page;

	protected int pageSize = 50;

	protected String sort;

	protected String sortDir;

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getSort() {
		return sort;
	}

	public String getSort(String def) {
		if (ValueUtil.empty(sort))
			return def;
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getSortDir() {
		return sortDir;
	}

	public String getSortDir(String def) {
		if (ValueUtil.empty(sortDir))
			return def;
		return sortDir;
	}

	public void setSortDir(String sortDir) {
		this.sortDir = sortDir;
	}

	public String orderStr(String ostr, String dstr) {
		return getSort(ostr) + " " + getSortDir(dstr);
	}

}
